<?php

/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/**
 * Description of BookingRoons
 *
 * @author fabiano
 */
class BookingRoons {
    //put your code here
    
    public $booking_room_id;
    public $booking_detail_id;
    public $room_id;
    public $num_adult;
    public $num_child;
    public $room_type;
    public $sale_price;
    public $nett_rate;    
    public $board_basis_code;
    
    
    function __construct($params = null) {
         if ($params != null){
            $this->setBooking_detail_id($params['booking_detail_id']);
            $this->setRoom_id($params['room_id']);
            $this->setNum_child($params['num_child']);
            $this->setRoom_type($params['room_type']);
            $this->setSale_price($params['sale_price']);
            $this->setNett_rate($params['nett_rate']);            
            $this->setBoard_basis_code($params['board_basis_code']);
            $this->setNum_adult($params['num_adult']);
         }

    }

    public function getNett_rate() {
        return $this->nett_rate;
    }

    public function setNett_rate($nett_rate) {
        $this->nett_rate = $nett_rate;
    }

    
    public function getBooking_room_id() {
        return $this->booking_room_id;
    }

    public function setBooking_room_id($booking_room_id) {
        $this->booking_room_id = $booking_room_id;
    }

    public function getBooking_detail_id() {
        return $this->booking_detail_id;
    }

    public function setBooking_detail_id($booking_detail_id) {
        $this->booking_detail_id = $booking_detail_id;
    }

    public function getRoom_id() {
        return $this->room_id;
    }

    public function setRoom_id($room_id) {
        $this->room_id = $room_id;
    }

    public function getNum_adult() {
        return $this->num_adult;
    }

    public function setNum_adult($num_adult) {
        $this->num_adult = $num_adult;
    }

    public function getNum_child() {
        return $this->num_child;
    }

    public function setNum_child($num_child) {
        $this->num_child = $num_child;
    }

    public function getRoom_type() {
        return $this->room_type;
    }

    public function setRoom_type($room_type) {
        $this->room_type = $room_type;
    }

    public function getSale_price() {
        return $this->sale_price;
    }

    public function setSale_price($sale_price) {
        $this->sale_price = $sale_price;
    }

    public function getBoard_basis_code() {
        return $this->board_basis_code;
    }

    public function setBoard_basis_code($board_basis_code) {
        $this->board_basis_code = $board_basis_code;
    }
    
    public function save (){
        //print_r($this); die();
        $sql = "INSERT INTO booking_roons SET ".make_set_clause(objectToArray($this));  
        error_log("[BookingRooms.class] - save " .$sql);
        $result = mysql_query($sql) or die (mysql_error());
        $this->booking_room_id = mysql_insert_id();  
    }
    
    public function get_booking_rooms_by_booking_detail_id($id){
        if(!empty($id)){		
	   $sql = "SELECT * FROM booking_roons WHERE booking_detail_id = " .$id;			
           error_log("[get_booking_rooms_by_booking_detail_id.class] - save " .$sql);
	   return apply_query($sql);
        } 
          else return null;
    }



    
    
    
}

?>
